﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Caliburn.Micro;
using System.ComponentModel.Composition;
using System.Windows.Media;
using System.Windows;
using FamilyShowSource.Events;
using FamilyShowSource.Models;

namespace FamilyShowSource.ViewModels
{
    [Export(typeof(NewUserViewModel))]
    public class NewUserViewModel
    {
        /// <summary>
        /// Request close this view
        /// </summary>
        public void Close()
        {
            // Create a new unknown person
            var newPerson = new Person();

            App.Family.Current = newPerson;
            App.Family.Add(newPerson);
            App.Family.IsDirty = false;

            // Notify to update GUI
            EventAggregatorFactory.Instance.GetEvent<NotifyActivateDiagramAndDetailEvent>().Publish(string.Empty);
        }

        /// <summary>
        /// Add new user
        /// </summary>
        public void Add()
        {
            EventAggregatorFactory.Instance.GetEvent<NotifyActivateDiagramAndDetailEvent>().Publish(string.Empty);
        }
    }
}
